<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Auto Parts</title>
<link rel="stylesheet" type="text/css" href="../../css/mokstyle.css" />
<style type="text/css">

td {
    font-size:12px; background-color:#fff7e5
}

table {background-color:#dbeaf5}

input {
    border:1px solid #B3D7F1
}

input.btn {border:1px solid #B3D7F1; background-color:#FFFFFF; cursor:hand}

.P {
    CURSOR:hand; background-image:url(images/toolbar.gif);
}

.T {
    BACKGROUND-COLOR:#e9f2f8;
		BORDER:1px solid #336699; CURSOR:hand
}

.LL {cursor:hand}

.toolbar {
    background-image:url(images/toolbar.gif); height:20px; 
	text-align:center; vertical-align:middle
}

.title1 {
    color:#003399; background-color:#dbeaf5; height:20px; text-align:center
}

.title2 {
    color:#003399; background-color:#dbeaf5; height:12px; text-align:center
}
a:hover	{TEXT-DECORATION:underline}

.requred_symbol { color:#FF0000; }
</style>
<script type="text/javascript">
	function change(id,a){
		document.getElementById('a1').style.textDecoration = 'none';
		document.getElementById('a2').style.textDecoration = 'none';
		document.getElementById("mt_form").style.display = 'none';
		document.getElementById("pt_form").style.display = 'none';
		document.getElementById(id).style.display = 'block';
		document.getElementById(a).style.textDecoration = 'underline';
	}
	function sendMt(){
		if("${eauser}"==""){
			alert("您还没有登录，请先登录！");
			return;
		}
		if("${eauser.userType}"!="6"||"${companyInfo.type}"!="1"){
			alert("您没有权限发布维修信息！");
			return;
		}
		var title = document.getElementById("tl").value;
		var price = document.getElementById("price").value;
		var infoMain = document.getElementById("infoMain").value;
		if(title==''){
			alert('标题不能为空！');
			return;
		}
		if(price==''){
			alert('预售价格不能为空！');
			return;
		}
		if(infoMain==''){
			alert('描述不能为空！');
			return;
		}
    	document.getElementById("mt_form").submit();
	}
	function sendPart(){
		if("${eauser}"==""){
			alert("您还没有登录，请先登录！");
			return;
		}
		if("${eauser.userType}"!="9"||"${companyInfo.type}"!="1"){
			alert("您没有权限发布维修信息！");
			return;
		}
	
		var paid = document.getElementById("paid").value;
		var paname = document.getElementById("paname").value;
		var type = document.getElementById("type").value;
		var companyName = document.getElementById("companyName").value;
		var num = document.getElementById("num").value;
		var util = document.getElementById("util").value;
		var ptprice = document.getElementById("ptprice").value;
		var infoPart = document.getElementById("infoPart").value;
		if(paid==''){
			alert('配件编号不能为空！');
			return;
		}
		if(paname==''){
			alert('配件名称不能为空！');
			return;
		}
		if(type==''){
			alert('型号不能为空！');
			return;
		}
		if(companyName==''){
			alert('厂商名称不能为空！');
			return;
		}
		if(num==''){
			alert('配件数量不能为空！');
			return;
		}
		if(util==''){
			alert('数量单位不能为空！');
			return;
		}
		if(ptprice==''){
			alert('单价不能为空！');
			return;
		}
		if(infoPart==''){
			alert('描述不能为空！');
			return;
		}
    	document.getElementById("pt_form").submit();
	}
	function check(){
		var ptprice = document.getElementById("ptprice").value;
		if(!/^\d*\.?\d*$/.test(ptprice)){
			alert("请输入数字");
			document.getElementById("ptprice").value = "";
		}
    }
</script>

</head>
<body>

<div  id="wrap">
 	<div class="header">
       		<div class="logo"><a href="/aasimp/mok/maintenance/index_getMtInfo"><img src="../../images/logo.gif" alt="" title="" border="0" /></a></div>            
        <div id="menu">
            <ul>                                                                       
            <li><a href="/aasimp/mok/maintenance/index_getMtInfo">首页</a></li>
            <li><a href="/aasimp/mok/maintenance/info_getcompany">个人资料</a></li>
            <li><a href="/aasimp/mok/maintenance/odd_getOdd" >维修申请</a></li>
            <li><a href="/aasimp/mok/maintenance/approve_showApprove">审批维修</a></li>
            <li><a href="/aasimp/mok/maintenance/mt_showmts">维修记录</a></li>
            <li class="selected"><a href="sendInfo.jsp">信息发布</a></li>
            <li><a href="/aasimp/mok/maintenance/report_showMtReport">报表统计</a></li>
            </ul>
        </div>  
       </div> 
       
       <div class="center_content" style="background-color:#FFFFFF;">
       	<div class="left_content" style="width: 880px;height: 100%;">
       		<div class="crumb_nav">
            <a href="/aasimp/mok/maintenance/index_getMtInfo">home</a> &gt;&gt; 发布信息
            </div>
            <div class="title"><span class="title_icon"><img src="../../images/bullet1.gif" alt="" title="" /></span>
            <a id="a1" href="javascript:void(0)" onclick="change('mt_form','a1')" style="text-decoration: underline;">维修信息</a>
            <a id="a2" href="javascript:void(0)" onclick="change('pt_form','a2')" style="text-decoration: none">配件信息</a></div>
        
        	<div class="feat_prod_box_details" style="height: 230px;">
            
              	<div class="contact_form" style="width: 780px;height: 100%;" align="center">
                <div class="form_subtitle">发布信息</div>
                 <form id="mt_form" name="register" action="/aasimp/mok/maintenance/send_saveMtInfo" style="display: block;">          
                    <div class="form_row">
                    <label class="contact"><strong>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：</strong></label>
                    <input type="text" class="contact_input" name="tl" id="tl"/>
                    </div> 

					<div class="form_row">
                    <label class="contact"><strong>预售价格：</strong></label>
                    <input type="text" class="contact_input" name="price" id="price" />
                    </div> 

                    <div class="form_row">
                    <label class="contact"><strong>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述：</strong></label>
                    <textarea rows="5" cols="27" class="contact_input" name="infoMain" id="infoMain" ></textarea>
                    </div> 
                    
                    <div class="form_row"><span style="color: red;" id="messageMt">${messageMt }</span>
                    <input type="button" onclick="sendMt()" class="register" value="发送" />
                    </div>   
                  </form>
                  <form id="pt_form" name="register" action="/aasimp/mok/maintenance/send_savePtInfo" style="display: none;">          
                   <table id="headTable" width="100%"  border="0" align="center" class="a1">
					  <tr align="justify">
					    <td>配件编号</td>
					    <td><input type="text" size="18" name="paid" id="paid"/>
					      </td>
					    <td>配件名称</td>
					    <td><input type="text" size="15" id="paname" name="paname"/>
					      </td>
					    <td>品牌</td>
					    <td><input type="text" size="15" name="brand" id="brand"/>
					      </td>
					    <td>型号</td>
					    <td><input type="text" size="15" id="type" name="type"/>
					      </td>
					  </tr>
					  <tr align="justify">
					    <td>厂商名称</td>
					    <td><input id="companyName" value="${companyInfo.companyName}" type="text" size="18" name="companyName"/>
					       </td>
					    <td>配件数量</td>
					    <td><input type="text" size="15" name="num" id="num"/></td>
					    <td>数量单位</td>
					    <td><input type="text" size="15" name="util" id="util"/></td>
					    <td>单价</td>
					    <td colspan="3"><input type="text" size="15" name="ptprice" id="ptprice" onkeyup="check()"/></td>
					    </tr>
					  <tr align="justify">
					    <td>描述</td>
					    <td colspan="3"><input type="text" size="40" name="infoPart" id="infoPart"/></td>
					    <td>照片</td>
					    <td colspan="3"><input type="file" size="35" name="image" id="image"/></td>
					   </tr>
					</table>
					<div class="form_row" style="width: 775px;">
                    	<input type="button" onclick="sendPart()" class="register" value="发送" />
                    </div>  
                  </form>         
                </div>  
            
          </div>	    
        <div class="clear"></div>
        </div><!--end of left content-->
        
       
       <div class="clear"></div>
       </div><!--end of center content-->
       
       <div class="footer">
       	<div class="left_footer"><img src="../../images/footer_logo.gif" alt="" title="" /><br /> </div>
        <div class="right_footer">
       
        </div>
        
       
       </div>
       
</div>
</body>
</html>